package com.cgwx.tcservice.convert;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import io.swagger.annotations.Api;

/**
 * @author GaoWei
 * @Date 2023/9/15 - 13:59
 */

@Api(tags = "读取Excel时，遥控参数处理方式转换器")
public class TcParameterModeConverter implements Converter {
    @Override
    public Class supportJavaTypeKey() {
        return null;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public Object convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        int tcParameterMode = 0;
        switch (cellData.toString()) {
            case "固定值":
                tcParameterMode = 1;
                break;
            case "补码":
                tcParameterMode = 2;
                break;
        }
        return tcParameterMode;
    }

    @Override
    public CellData convertToExcelData(Object o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return null;
    }
}
